<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    function Father(name, age) {
      this.name = name
      this.age = age
      this.say = function () {
        console.log('father say')
        console.log(this);
      }
    }
    function Son(sex) {
      //把Father的this改成这个函数的this（Son的this）
      Father.call(this)
      this.sex = sex
      this.eat = function () {
        console.log('son eat');
        console.log(this);
      }
    }
    var s = new Son('小明', '男')
    console.log(s)
    s.eat()
    s.say()
  </script>
</body>

</html>